<template>
  <el-form ref="form" label-width="80px" size="mini">
    <span>关系编辑器</span>
    <el-form-item label="标签名称">
      <el-input v-model="modelForm.label" />
    </el-form-item>
    <el-form-item label="填充颜色">
      <el-color-picker v-model="modelForm.style.stroke" />
    </el-form-item>
  </el-form>
</template>

<script lang="ts">
import { defineComponent, reactive } from 'vue'
export default defineComponent({
  // 节点编辑器
  name: 'NodeEditor',
  props: {},
  emits: ['save'],
  setup() {
    const modelForm = reactive({
      label: '',
      style: {
        stroke: null,
      },
    })
    // 打开
    const setData = function (data) {
      modelForm.label = data.label
      modelForm.style = {
        stroke: data.style.stroke,
      }
    }
    // 保存表单
    const getData = function () {
      return { ...modelForm }
    }

    return {
      modelForm,
      setData,
      getData,
    }
  },
})
</script>

<style lang="scss" scope></style>
